﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Cherry.Agile.Configuration;
using System.Configuration;

namespace Cherry.Agile.Scheduler.Configuration
{
    
    /// <summary>
    /// 
    /// </summary>
    public class SchedulerElementCollection : ConfigurationElementCollection
    {
        /// <summary>
        /// 
        /// </summary>
        public SchedulerElementCollection()
        {
            base.AddElementName = "scheduler";
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        protected override ConfigurationElement CreateNewElement()
        {
            return new SchedulerElement();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        protected override object GetElementKey(ConfigurationElement element)
        {
            var el = (element as SchedulerElement);
            return string.Format("{0}",el.Type);
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public class SchedulerElement : ConfigurationElement
    {
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("type", IsRequired = true)]
        public string Type
        {
            get { return (string)base["type"]; }
            set { base["type"] = value; }
        }
 
    }
}
